package com.moter.estest.util;

import com.moter.estest.result.ResultCodeEnum;


public class MoterException extends RuntimeException{
    private Integer code;

    public MoterException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public MoterException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "MoterException{" +
                "code=" + code + ",\t"
                +"message="+getMessage()+
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public MoterException setCode(Integer code) {
        this.code = code;
        return this;
    }
}
